Skip to content

Conversation

@aayush-kapoor
Copy link
Contributor

@aayush-kapoor aayush-kapoor commented Oct 29, 2025

Background

OpenAI Code Interpreter tool generates files based on users question/query but our current implementation of annotations didn't support container_file_citation. Hence files generated were getting lost

See #9175

Summary

Updated spec to include container_file_citation and file_path as specified in the OAI spec here

Manual Verification

Ran + updated examples examples/ai-core/src/generate-text/openai-responses-code-interpreter.ts & examples/ai-core/src/generate-text/openai-code-interpreter-tool.ts

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)

Future Work

  • update docs
  • try integrating it with a UI example so that the files can be downloaded.

Related Issues

Fixes #9175

@gr2m gr2m self-assigned this Oct 29, 2025
Copy link
Collaborator

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good

Ran + updated examples examples/ai-core/src/generate-text/openai-responses-code-interpreter.ts & examples/ai-core/src/generate-text/openai-code-interpreter-tool.ts

Can you please also alter one of the examples/next-openai/app examples and try it with a multi-turn chat?

@lgrammel
Copy link
Collaborator

lgrammel commented Oct 29, 2025

why is the annotations subkey needed? this will go into stored data via ui messages and is therefore hard to change. (nevermind realized it is an array)

@aayush-kapoor
Copy link
Contributor Author

Can you please also alter one of the examples/next-openai/app examples and try it with a multi-turn chat?

So I ran the example examples/next-openai/app/test-openai-code-interpreter/page.tsx and without updating the example, I noticed that the model responds back with the annotation details about the files generated.

Adding an example that allows the user to download the file will mean we have to add an API call to retrieve the file data from the container created in OpenAI backend. I thought that wouldn't be necessary for this change but I can add

@aayush-kapoor
Copy link
Contributor Author

aayush-kapoor commented Oct 29, 2025

why is the annotations subkey needed? this will go into stored data via ui messages and is therefore hard to change.

@lgrammel i thought storing it the same way we receive from openai api would be easy to follow - would we need the annotation subkey for any other component or this is more to be on the safer side?

Do you think just storing it in the source would be sufficient?

@lgrammel
Copy link
Collaborator

@aayush-kapoor dont mind my comment, didnt realize annotations are an array.

@aayush-kapoor
Copy link
Contributor Author

aayush-kapoor commented Oct 30, 2025

noted! @gr2m lmk if this is good to merge, re my comment ^

@aayush-kapoor
Copy link
Contributor Author

added a ui example that allows to download file under examples/next-openai/app/test-openai-code-interpreter-annotation-download/page.tsx

@gr2m gr2m removed their assignment Nov 3, 2025
@aayush-kapoor aayush-kapoor merged commit b82987c into main Nov 3, 2025
20 checks passed
@aayush-kapoor aayush-kapoor deleted the aayush/9175-retrieve-code-interpreter-file branch November 3, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No Way to retreive Openai Code Interpreter tool generated file!

4 participants